package cn.zhoutingrui.pethome.utils;

public class AjaxResultUtil {
    private String msg;
    private Boolean flag;
    private Object data;
    private Long total;

    public AjaxResultUtil() {
    }

    public AjaxResultUtil(String msg, Boolean flag) {
        this.msg = msg;
        this.flag = flag;
    }

    public static AjaxResultUtil success(){
        return new AjaxResultUtil("操作成功",true);
    }

    public static AjaxResultUtil fail(){
        return new AjaxResultUtil("操作失败",false);
    }

    public String getMsg() {
        return msg;
    }

    public AjaxResultUtil setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Boolean getFlag() {
        return flag;
    }

    public void setFlag(Boolean flag) {
        this.flag = flag;
    }

    public Object getData() {
        return data;
    }

    public AjaxResultUtil setData(Object data) {
        this.data = data;
        return this;
    }

    public Long getTotal() {
        return total;
    }

    public AjaxResultUtil setTotal(Long total) {
        this.total = total;
        return this;
    }

    @Override
    public String toString() {
        return "AjaxResultUtil{" +
                "msg='" + msg + '\'' +
                ", flag=" + flag +
                ", data=" + data +
                ", total=" + total +
                '}';
    }
}
